<template>
	<!-- 教师 预习 作业 考试 班级里学生列表-->
	<page-body>
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center flex_0_ibhf"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub fd0_0_ibhf'>
					<view class='flex flex-wrap align-center fd0_0_c0_ibhf' @tap.stop="handleJumpDiy" data-type="back"
						data-url="1">
						<text class='fu-iconfont2  fd0_0_c0_c0_ibhf'>&#xE794;</text>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
						<text class='fd0_0_c1_c0_ibhf'>{{name}}</text>
					</view>
					<view class='flex flex-wrap align-center justify-end fd0_0_c0_ibhf'>
					</view>
				</view>
			
			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction align-stretch benben-flex-layout">
				<view>
					<benben-flex-tabs class-name='benbenTabsfd1_0_ibhf' v-model="tab" ref="benben_tabsfd1_0"
						select-mark="benben_tabsfd1_0" key="benben_tabsfd1_0" :open-title-type='false'
						:open-sticky='true' :top='0' :is-show-content='false' :scrollspy='false'
						:tabs-info.sync="tabsInfofd1_0">

						<scroll-view @scroll="tabsInfofd1_0.scrollX = $event.detail.scrollLeft" id="benben_tabsfd1_0"
							class="benben-tabs" style="width:750rpx" :scroll-x="true" :scroll-left="tabsInfofd1_0.moveX"
							scroll-with-animation="all .3s ease" :show-scrollbar='false' :enhanced="true">
							<view class="benben-tabs-content" id="benben_tabsfd1_0-content">
								<view id="benben_tabsfd1_0-title"
									class="benben-tabs-title flex flex align-center justify-around">
									<view
										:class="{ 'checkTitlefd1_0_ibhf': tab == '1', 'flex flex-wrap align-center': true }"
										@tap="getlist(1)" :id="`benben_tabsfd1_0-title-item-${'1'}`">

										<text>已提交<!-- {{type==3?'批改':'提交'}} --></text>
										<!-- <text :class="tab==1?'se':'hui'">（33）</text> -->

									</view>
									<view
										:class="{ 'checkTitlefd1_0_ibhf': tab == '2', 'flex flex-wrap align-center': true }"
										@tap="getlist(2)" :id="`benben_tabsfd1_0-title-item-${'2'}`">

										<text>未提交<!-- {{type==3?'批改':'提交'}} --></text>
										<!-- <text :class="tab==2?'se':'hui'">（33）</text> -->

									</view>
								</view>
								<view :style="{ left: tabsInfofd1_0.lineleft, maxWidth: tabsInfofd1_0.lineWidth ,}"
									id="benben_tabsfd1_0-line"
									class="benben-tabs-line flex benben-flex-tabs-line linefd1_0_ibhf"
									:class="{'benben-tabs-line-active':tabsInfofd1_0.isInit}"></view>
							</view>
						</scroll-view>

					</benben-flex-tabs>

				</view>
				<view class='flex flex-direction align-stretch fd1_1_ibhf'>
					<template v-for='(item,key0) in list'>
						<view class='flex flex-wrap align-center fd1_0_ibhf' :key='key0' @tap.stop="jump(item,key0)">
							<image class='fd1_0_c0_ibhf' mode="aspectFit" :src='item.user_avatar?item.user_avatar:STATIC_URL+"LOGO.png"'></image>
							<view class='flex flex-direction align-stretch flex-sub'>
								<text class='fd1_0_c1_c0_ibhf'>{{item.user_real_name}}</text>
								<text class='fd1_0_c1_c1_ibhf' v-if="tab==1">提交时间：{{item.submission_time}}</text>
							</view>
							<view class="" v-if="type!=3">
								<view class="number" v-if="tab==1 && item.is_graded==1">
									<text class=''>{{item.score}}</text>
									<text class='fd1_0_c2_ibhf'>分</text>
								</view>
								<view class="number dai" v-if="tab==1 && item.is_graded == 0">
									<text class=''>待批阅</text>
								</view>
							</view>
							<view class="" v-if="type==3">
								<view class="number" v-if="tab==1 && item.is_correct==2">
									<text class=''>{{item.score}}</text>
									<text class='fd1_0_c2_ibhf'>分</text>
								</view>
								<view class="number dai" v-if="tab==1 && item.is_correct == 1">
									<text class=''>待批阅</text>
								</view>
							</view>
						</view>
					</template>
				</view>
			</view>
			<fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
				:listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
			<!-- <view v-if="list.length==0 && isup">
				<slot>
					<view class="public-page-empty">
						<image src='/static/global/order.png'></image>
						<view class="txt">暂无数据</view>
					</view>
				</slot>
			</view> -->

			<!---flex布局flex布局结束-->
			<view v-if="tab==2 && list.length>0" class="flex flex-direction flex-wrap align-center justify-center benben-position-layout flex list_flex_3_ibhf">
				<button class='list_fd3_0_ibhf' @tap.stop="dc">一键督促</button>

			</view>
			<view :style="{height: '88rpx'}"></view>

		</view>
	</page-body>
</template>
<script>
	import pagingList from '@/common/mixin/paging_list.js';
	export default {
		components: {},
		mixins: [pagingList],

		data() {
			return {
				"tabsInfofd1_0": {
					lineleft: '',
					lineWidth: '',
					moveX: 0,
					scrollX: 0,
					PageScrollX: 0,
					isInit: false
				},
				"tab": "1",
				"list": [],
				name:'',
				id:'',
				isup:false,
				"minixPagingListsApi": "",
				"pageingListApiMethod": "",
				"allowOnloadGetList": false,
				homeworkreleaserecord_id:'',
				teachingclass_id:'',
				type:1,//1预习 2作业 3考试
				papercourse_id:'',//试卷id
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			this.name=options.name
			this.homework_id=options.homework_id
			this.homeworkreleaserecord_id=options.homeworkreleaserecord_id
			this.teachingclass_id=options.teachingclass_id
			this.papercourse_id=options.papercourse_id
			this.type=options.type?options.type:1
			this.getlist(1)
			if (global.appTabBarType) this.toHomeDiy()
			let _this=this
			// 教师提交评语
			uni.$on('addpy', (data) => {
				_this.getlist(1)
			});
		},
		onUnload() {
			uni.$off('addpy');
		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {
			if(this.tab==1){
				this.getlist(1)
			}else{
				this.getlist(2)
			}
		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			async getlist(type) {
				this.tab=type
				let url=''
				let obj={
					
				}
				if(this.type!=3){
					url= global.apiUrls.post68cd1395aad28
					obj={
						aid:this.homeworkreleaserecord_id,
						homework_id:this.homework_id,
						teachingclass_id:this.teachingclass_id,
						is_submit:this.tab==2?0:1,
					}
				}else{
					url= global.apiUrls.post68f6e55b68de3
					obj={
							teachingclass_id:this.teachingclass_id,
							papercourse_id:this.papercourse_id,
							is_submit:this.tab==2?0:1,
						// teachingclass_id:this.teachingclass_id,
						// is_correct:this.tab==2?1:2,
					}
				}
				this.minixPagingListsApi = url;
				this.pageingListApiMethod = 'get';
				this.allowOnloadGetList = false;
				this.pagingListPostDataContent = obj
				this.listData = [];
				this.list = this.listData;
				console.log("this.list=>", this.list)
				this.pagingListToggle();
				this.$forceUpdate()
				// let datadatum = await this.$api.get(global.apiUrls.post68cd1395aad28, {
				// 		homework_id:this.id,
				// 		is_submit:this.tab
				// });
				// this.isup = true
				// if (datadatum.data.code != 1) {
				// 	this.$message.info(datadatum.data.msg);
				// 	return
				// }
				// let infodatum = datadatum.data;
				// this.list = infodatum.data
				// console.log(infodatum)
			},
			jump(item, index) {
				console.log(item)
				if (this.tab == 1) {
					if(this.type!=3){
						if(item.is_graded==0){
							// 未批阅 直接去批阅
							uni.navigateTo({
								url:'/pages/kc/teacherdtxq/teacherdtxq?homeworkreleaserecord_id='+this.homeworkreleaserecord_id+'&uid='+item.user_id+'&homework_id='+this.homework_id+'&aid='+item.aid+'&name='+item.user_real_name+'&type=1&isgraded='
							})
						}else{
							uni.navigateTo({
								url: "/pages/kc/cjd/cjd?uid="+item.user_id+'&homeworkreleaserecord_id='+this.homeworkreleaserecord_id+'&aid='+item.aid+'&homework_id='+this.homework_id+'&name='+item.user_real_name+'&type=1'
							})
						}
						
					}else{
						// 未批阅 直接去批阅
						if(item.is_correct==1){
							uni.navigateTo({
								url:'/pages/kc/teacherdtxq/teacherdtxq?papercourse_id='+item.papercourse_id+'&uid='+item.user_id+'&name='+item.user_real_name+'&type=3&isgraded='
							})
						}else{
							uni.navigateTo({
								url: "/pages/kc/cjd/cjd?uid="+item.user_id+'&papercourse_id='+item.papercourse_id+'&type=3'+'&name='+item.user_real_name
							})
						}
						
					}
					
				} else {
					// uni.navigateTo({
					// 	url: "/pages/kc/examinationRes/examinationRes?type=2"
					// })
				}

			},
			dc(){
				uni.showModal({
					title:"提示",
					content:"系统将通知督促学生未交学生尽快完成！",
					confirmColor:"#145EFD",
					complete() {
						
					}
				})
			},
			pagingListPostData() {
				return this.pagingListPostDataContent
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: rgba(255, 255, 255, 1);
		background-size: 100% auto;
		.flex_0_ibhf {
			width: 750rpx;
			height: 88rpx;
			overflow: hidden;
			z-index: 10;
			top: 0rpx;
			background: #fff;
			background-size: 100% auto !important;
		
			.fd0_0_ibhf {
				padding: 0rpx 32rpx 0rpx 32rpx;
		
				.fd0_0_c1_c0_ibhf {
					font-size: 36rpx;
					font-weight: 700;
					color: #333333;
					line-height: 50rpx;
				}
			}
		}
		.se {
			color: #1C5EFC;
		}

		.hui {
			color: #999999;
		}

		.checkTitlefd1_0_ibhf {
			font-weight: 700 !important;
			font-size: 28rpx !important;
			color: #333 !important;
			background-color: rgba(255, 255, 255, 1) !important;
		}

		.linefd1_0_ibhf {
			width: 40rpx;
			height: 8rpx;
			top: 80rpx;
			background: #145efd;
			background-size: 100% auto !important;
			border-radius: 4rpx;
		}

		.fd1_1_ibhf {
			padding: 0rpx 24rpx 0rpx 24rpx;
		}

		.fd1_1_c0_ibhf {
			border-bottom: 1px solid #eee;
			padding: 24rpx 0rpx 24rpx 0rpx;
		}

		.fd1_1_c0_c0_c0_ibhf {
			font-size: 32rpx;
			margin: 0rpx 0rpx 24rpx 0rpx;
		}

		.fd1_1_c0_c0_c1_ibhf {
			font-size: 24rpx;
			color: #999999;
		}

		.flex_0_ibhf {
			width: 750rpx;
			height: 88rpx;
			overflow: hidden;
			z-index: 10;
			top: 0rpx;
			background: #fff;
			background-size: 100% auto !important;

			.fd0_0_ibhf {
				padding: 0rpx 32rpx 0rpx 32rpx;

				.fd0_0_c1_c0_ibhf {
					font-size: 36rpx;
					font-weight: 700;
					color: #333333;
					line-height: 50rpx;
				}
			}
		}

		.fd0_0_c0_ibhf {
			width: 120rpx;

			.fd0_0_c0_c0_ibhf {
				font-size: 36rpx;
				color: #333;
			}
		}
	}

	::v-deep .benbenTabsfd1_0_ibhf {
		width: 750rpx;
		height: 90rpx;
		white-space: nowrap;
		background: #fff;
		text-align: center;
	}

	.fd1_0_ibhf {
		padding: 24rpx 0rpx 24rpx 0rpx;
		border-bottom: 1px solid #eee;

		.number {
			color: #145EFD;
		}
		.dai{
			color: #EE8231;
		}
		.fd1_0_c0_ibhf {
			width: 84rpx;
			height: 84rpx;
			border-radius: 40rpx;
			margin: 0rpx 20rpx 0rpx 0rpx;
		}

		.fd1_0_c1_c0_ibhf {
			font-size: 32rpx;
			font-weight: 600;
		}

		.fd1_0_c1_c1_ibhf {
			margin: 4rpx 0rpx 0rpx 0rpx;
			font-size: 24rpx;
			color: rgba(153, 153, 153, 1);
		}

		.fd1_0_c2_ibhf {
			color: rgba(153, 153, 153, 1);
		}
	}

	.list_flex_3_ibhf {
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		bottom: calc(88rpx + var(--window-bottom));

		.list_fd3_0_ibhf {
			border-radius: 12rpx;
			width: 702rpx;
			line-height: 84rpx;
			font-size: 24rpx;
			background: #145EFD;
			color: #fff;
			height: 84rpx;
		}
	}
	.public-page-empty {
			display: flex;
			justify-content: center;
			flex-direction: column;
			align-items: center;
			padding: 120upx 0 0 0;
		
			image {
				width: 300rpx;
				height: 300rpx;
			}
		
			.txt {
				font-size: 28upx;
				color: $uni-text-color;
				text-align: center;
				line-height: 100upx;
				color: var(--benben-loading-color, #999999);
			}
		
			.loadTips {
				line-height: 30upx;
			}
		
			.btn {
				width: 260upx;
				height: 78upx;
				line-height: 78upx;
				background: linear-gradient(309deg, rgba(254, 49, 0, 1) 0%, rgba(255, 90, 16, 1) 100%);
				opacity: 1;
				border-radius: 44upx;
				font-size: 28upx;
				color: #fff;
				text-align: center;
				margin-top: 100upx;
			}
		}
	
</style>
